package main

import "sort"

func twoSum(numbers []int, target int) []int {
	for i, v := range numbers {
		if i == len(numbers) - 1 {
			break
		}
		tmp := numbers[i+1:]
		j := sort.Search(len(tmp), func(i int) bool {
			return tmp[i] >= target - v
		})
		if j < len(tmp) && v + tmp[j] == target {
			return []int{i+1, i+j+2}
		}
	}
	return nil
}

func main() {
	res := twoSum([]int{-1, -1, 2}, -2)
	println(res)
}